package com.example.demo.controller;
//import com.ice.tar.TarEntry;
//import com.ice.tar.TarInputStream;
import com.example.demo.mapper.LogMapper;
import com.example.demo.service.ILogService;
import io.swagger.annotations.Api;
//import net.sf.sevenzipjbinding.*;
//import net.sf.sevenzipjbinding.impl.RandomAccessFileInStream;
//import net.sf.sevenzipjbinding.simple.ISimpleInArchive;
//import net.sf.sevenzipjbinding.simple.ISimpleInArchiveItem;
//import org.apache.commons.io.IOUtils;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

//import de.innosystec.unrar.Archive;
//import de.innosystec.unrar.rarfile.FileHeader;


//@Api(tags = "测试框架2")
@RestController
@RequestMapping("manageSystemVue3")
public class Vue3FrontTestController {
        @Autowired
        ILogService logService;

        @Autowired
        LogMapper logMapper;
        @ApiOperation("login")
        @RequestMapping("login")
        public Boolean login(@RequestBody Map<String,Object>map){
                String username = (String) map.get("username");
                String password = (String) map.get("password");

                if(logService.login(username,password)!=null){
                        return true;
                }
                return false;
        }
        @RequestMapping("checkUser")
        public Boolean checkUser(@RequestBody Map<String,Object>map){
                String username = (String) map.get("username");
                if(logMapper.checkUser(username)!=null){
                        return true;
                }
                return false;
        }
        @RequestMapping("register")
        public Boolean register(@RequestBody Map<String,Object>map){
                String username = (String) map.get("username");
                String password = (String) map.get("password");
                if(logMapper.checkUser(username)!=null){
                        return false;
                }
                logMapper.register(username,password);
                return true;
        }

}